<?php

// Aug 12, 2010: immanuel192 write this action to return aritcle items

if (!defined('EXPONENT')) exit('');

global $db;
// get t2 value, just for fun
$t2=$_GET['t2'];
$id = -1;

// get location data first
// and query with condition: location _data plus cat_id

if (isset($_REQUEST['cat_id']))
{
	$id = intval($_REQUEST['cat_id']);
	// get location data first
	$temp=$db->selectObject("category","id = " . $id);
	if (!$temp) die();
	
	$data=$db->selectObjects("article","location_data = '{$temp->location_data}' AND category_id = {$id} ORDER BY rank DESC");
	$html="<option value='-1'>----</option>"; 
	foreach ($data as $k=>$v)
	{
		$html.="<option value='{$v->id}'>{$v->title}</option>";
	}
	echo $t2; echo $html;	
}
else
{
	die();
}
?>
